package com.qk.management.config;

import com.qk.properties.JwtProperties;
import com.qk.util.JwtUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author:zhengbowen
 * @Date: 2025/10/09 17:02
 * @Description:
 */
@Configuration
@EnableConfigurationProperties(JwtProperties.class)
public class JwtConfig {

    @Bean
    @ConditionalOnMissingBean
    public JwtUtils jwtUtils(JwtProperties jwtProperties) {
        return new JwtUtils(
                jwtProperties.getSecretKey(),
                jwtProperties.getTtlMillis());
    }
}
